package com.mh.caipiao.vo;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mh.caipiao.entity.CaiPiaoEntity;
import com.mh.caipiao.service.CaiPiaoService;
import com.mh.mh.util.WuXingRelationUtil;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Data
@Component
public class MyVo {

    String start = "2023-05-08";
    String end = "2023-06-21";

    private List<CaiPiaoEntity> list;
    private CaiPiaoEntity caiPiaoEntity;

    @Autowired
    private CaiPiaoService caiPiaoService;

    @Autowired
    private WuXingRelationUtil wuXingRelationUtil;


    public void getCiapList(){
        List<CaiPiaoEntity> list = caiPiaoService.list(
                new LambdaQueryWrapper<CaiPiaoEntity>().ge(CaiPiaoEntity::getKjDate, start)
                        .le(CaiPiaoEntity::getKjDate, end)
        );
        this.setList(list);
    }

    public void getCaipEntity(String code){
        CaiPiaoEntity byId = caiPiaoService.getById("2023-02-04");
        byId.setCode(code);
        this.setCaiPiaoEntity(byId);
    }


}
